package com.github.yealove.configgen.mapper;

import com.github.yealove.configgen.model.Group;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface GroupMapper {

    @Select("select * from cg_group order by create_time asc")
    List<Group> getAllGroup();

    @Select("select * from cg_group where id = #{gId}")
    Group getGroupById(int gId);

    @Insert("insert into cg_group(name, create_time) values(#{name}, now())")
    void addGroup(String name);
}
